#pragma once
#include <math.h>

#include <set>

#include "DataStructure/Common/Constant.h"
#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Real.h"
#include "DataStructure/Common/SGObject.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
///< @brief 节点数据结构体，包含了有关节点的位置、坐标系、约束等信息。
struct DECLSPEC NodeData : public SGObject
{
    /** @brief 获得节点上永久约束，当无约束时， 返回空集合 */
    SG::DataStructure::FEM::DofSet GetConstraint () const;

    SG::DataStructure::Common::Id   m_defCoord  = 0;        ///< 节点坐标的参考坐标系的ID
    SG::DataStructure::Common::Real m_x[3]      = { 0.0 };  ///< 在CP坐标系中的节点坐标值
    SG::DataStructure::Common::Id   m_dispCoord = 0;  ///< 定义在节点处的位移、自由度、约束和解向量的坐标系的ID
    SG::DataStructure::Common::I64  m_ps        = 0;  ///< 节点的永久单点约束
    SG::DataStructure::Common::I64  m_seid      = 0;  ///< 超单元的ID
    SG::DataStructure::Common::Id   m_dominId   = 0;  ///<
};

///< @brief 判断节点数据是否相等
DECLSPEC bool operator== (const NodeData& a, const NodeData& b);

using NodeDataSet = std::set<NodeData>;

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE